package view;

import model.GameState;

import javax.swing.*;
import java.awt.*;

/**
 * Created with IntelliJ IDEA.
 * User: Student
 * Date: 29/11/12
 * Time: 16:06
 * To change this template use File | Settings | File Templates.
 */
public class GamePanel extends JPanel {

    private static GamePanel instance = null;
    public static GamePanel getInstance(GameState gameState) {
        if(instance == null){
            instance = new GamePanel(gameState);
        }
        return instance;
    }

    public static GamePanel getInstance() {
        if(instance == null){
            return null;
        }
        return instance;
    }
    private BoardPanel boardPanel = null;
    private ConfigPanel configPanel = null;

    private GamePanel(GameState gameState) {
        setLayout(new BorderLayout());
        add(new ControlPanel(), BorderLayout.EAST);
        boardPanel =  new BoardPanel(gameState);
        add(boardPanel, BorderLayout.CENTER);
    }

    public void update(GameState gameState){
        boardPanel.clearBoard();
        boardPanel.updateBoard(gameState);


    }

}
